<?php
/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2018-07-03
 * Time: 16:49
 */

class MY_Controller extends CI_Controller
{

    public function __construct()
    {
        parent::__construct();
    }


    function getUserByOpenid(){
        $oppenid = $this->input->post('oppenid');
        $sql = " SELECT * FROM userinfo WHERE 1=1 ";
        if (!empty($oppenid)){
            // $sql = " SELECT * FROM userinfo WHERE 1=1 "." and oppenid = "."'$oppenid'";
            $sql = $sql." and oppenid = "."'$oppenid'";
            $query = $this->db->query($sql);
            // echo json_encode($query->result(), JSON_UNESCAPED_UNICODE);
            return $query->result();
        }else {
            $ajax_res['start'] = 300;
            $ajax_res['content'] = 'oppenid为空或未录入';
            echo json_encode($ajax_res, JSON_UNESCAPED_UNICODE);
            return null;
        }
    }


}